package com.heima;

public class OperatorDemo4 {
    public static void main(String[] args) {
        //学会使用赋值运算符： = += -= *= /= %=
        int a = 10;
        int b = 200;
        //a = a+b;
        a+=b;//a = (int)(a+b);
        System.out.println(a);

        byte i = 10;
        byte j = 20;
        //i = (byte)(i+j); //不强制转换成byte会报错，这样写比较麻烦
        i+=j;//直接加后赋值，i = (byte)(i+j);
        System.out.println(i);

        int m = 10;
        int n = 5;
//        m += n;
//        m -= n;//等价于：m = (int)(m-n);
//        m *= n;//等价于：m = (int)(m*n);
//        m /= n;//等价于：m = (int)(m/n);
        m %= n;//等价于：m = (int)(m-n);
        System.out.println(m);
    }
}
